// 导入fs模块
import fs from 'fs'
//创建promise对象
const p1 = new Promise((resolve, reject) => {
    fs.readFile('./txt/a.txt', 'utf8', (err, data) => {
        resolve(data)//成功的结果
    })
})
const p2 = new Promise((resolve, reject) => {
    fs.readFile('./txt/b.txt', 'utf8', (err, data) => {
        resolve(data)//成功的结果
    })
})
const p3 = new Promise((resolve, reject) => {
    fs.readFile('./txt/c.txt', 'utf8', (err, data) => {
        resolve(data)//成功的结果
    })
})

// 读取文件

const a = p1.then(res => {
    console.log(res);
    return p2
})

const b = p2.then(res => {
    console.log(res);
    return p3
})

p3.then(res => {
    console.log(res);
})

